from pydantic import BaseModel
from typing import Optional

from app.schemas.result import BaseResult
from app.schemas.user import UserResult


class Token(BaseModel):
    access_token: str
    token_type: str

class TokenPayload(BaseModel):
    sub: Optional[int] = None

class LoginForm(BaseModel):
    username: str
    password: str

    # class Config:
    #     json_schema_extra = {
    #         "example": {
    #             "username": "admin",
    #             "password": "123456"
    #         }
    #     }


class TokenUser(BaseModel):
    id: Optional[int] = None
    email: str
    username: str
    nickname: str

class TokenInfoResult(BaseResult):
    user: Optional[TokenUser] = None
